package com.xingkeduo.service.dict.impl;

import java.util.List;

import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.xingkeduo.dao.TDictMarketingMapper;
import com.xingkeduo.model.example.TDictMarketingExample;
import com.xingkeduo.model.example.TDictMarketingExample.Criteria;
import com.xingkeduo.model.po.TDictMarketing;
import com.xingkeduo.service.dict.DictMarketingService;
import com.xingkeduo.util.Constant;
@Service
public class DictMarketingServiceImpl implements DictMarketingService {

	@Autowired
	TDictMarketingMapper tDictMarketingMapper;

	@Override
	public List<TDictMarketing> queryDictMarketingByTypeCodeAndItemCode(String typeCode, String itemCode) {
		TDictMarketingExample example = new TDictMarketingExample();
		Criteria criteria = example.createCriteria();
		if (StringUtils.isNotBlank(typeCode)) {
			criteria.andTypeCodeEqualTo(typeCode);
		}
		if (StringUtils.isNotBlank(itemCode)) {
			criteria.andItemCodeEqualTo(itemCode);
		}
		criteria.andIsDeleteEqualTo(Constant.STATUS_NO);
		example.setOrderByClause(" sort_no desc");
		List<TDictMarketing> dictMarketingList = tDictMarketingMapper.selectByExample(example);
		return dictMarketingList;
	}

}
